package com.longge;

import java.util.HashMap;

public class CanPermutePalindrome {
    public boolean canPermutePalindrome(String s) {

        HashMap<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            Integer num = map.getOrDefault(c, 0);
            map.put(c, num + 1);
        }
        int count = 0;
        for (Integer value : map.values()) {
            if (value % 2 == 1) {
                count++;
            }
            if (count > 1) return false;
        }
        return true;
    }

}
